

java_name = input('请输入java文件名：')

contents=[]
target_package = 'setparam.txt'
with open(java_name + '.java', 'r', encoding='utf-8') as f:
	lists = f.readlines();
	# print(lists)
	for e in lists: 
		# print(e.replace('\n', ''))
		split_e = e.replace('\n', '').split(' ')
		if 'import' in split_e:
			continue
		elif 'class' in split_e:
			# print(split_e.index('class'))
			index_class = split_e.index('class')
			# print(split_e[index_class+1])
			contents.append(split_e[index_class+1] + ' param = new ' + split_e[index_class+1] + '();\n')
		elif 'String' in split_e:
			index_String = split_e.index('String')
			contents.append('param.set' + split_e[index_String+1][0].upper() + split_e[index_String+1][1:-1] + '(""); ' + ''.join(split_e[index_String+2:]) + '\n')
		elif 'Integer' in split_e:
			index_Integer = split_e.index('Integer')
			contents.append('param.set' + split_e[index_Integer+1][0].upper() + split_e[index_Integer+1][1:-1] + '(""); ' + ''.join(split_e[index_Integer+2:]) + '\n')
		elif 'List<String>' in split_e:
			index_0 = split_e.index('List<String>')
			index_1 = index_0 + 1
			index_2 = index_0 + 2
			contents.append('param.set' + split_e[index_1][0].upper() + split_e[index_1][1:-1] + '(""); ' + ''.join(split_e[index_2:])+ '\n')
	for content in contents:
		print(content)

with open(target_package, 'w', encoding='utf-8') as f:
	f.writelines(contents)